/* eslint-disable @typescript-eslint/no-unused-vars */
import { BasicColumn, BasicTable, FormSchema, useRender, useTable } from "@/components/Table";
import "./index.less";
import { useTranslation } from "react-i18next";
import ToolBar from "@/components/ViewComponents/Toolbar";
import { patOrdersItemsPage } from "@/api/MedicalExamination";

const index = () => {
	const { t } = useTranslation();
	const searchFormSchema: FormSchema[] = [
		{
			label: t("kevin_ui.from_date"),
			field: "tu_ngay",
			component: "DatePicker"
		},
		{
			label: t("kevin_ui.to"),
			field: "den",
			component: "DatePicker"
		},
		{
			label: t("kevin_ui.type"),
			field: "loai",
			component: "Select",
			componentProps: {
				options: [
					{ label: "Routine Checkup", value: "常规检查" },
					{ label: "Surgical Record", value: "手术记录" },
					{ label: "Follow-up Record", value: "复查记录" }
				]
			}
		},
		{
			label: t("felix_ui.dept_name"),
			field: "khoa_phong",
			component: "Select",
			componentProps: {
				options: [
					{ label: "Internal Medicine", value: "内科" },
					{ label: "Surgery", value: "外科" },
					{ label: "Pediatrics", value: "儿科" }
				]
			}
		},
		{
			label: t("kevin_ui.pat_subject"),
			field: "doi_tuong",
			component: "Select",
			componentProps: {
				options: [
					{ label: "Outpatient", value: "门诊患者" },
					{ label: "Inpatient", value: "住院患者" },
					{ label: "Pediatric Patient", value: "儿童患者" }
				]
			}
		}
	];
	const columns: BasicColumn[] = [
		{
			title: t("kevin_ui.content"),
			dataIndex: "bizName"
		},
		{
			title: t("kevin_ui.designated_case"),
			dataIndex: "designated_case",
			render: (_, record) => (record.patOrders ? useRender.renderDate(record.patOrders.createdTime) : "")
		},
		{
			title: t("kevin_ui.cash_register"),
			dataIndex: "pmtTime",
			render: text => (text ? useRender.renderDate(text) : "")
		},
		{
			title: t("kevin_ui.amount_collected"),
			dataIndex: "bizPrice"
		},
		{
			title: t("kevin_ui.performed_case"),
			dataIndex: "performedTime",
			render: text => (text ? useRender.renderDate(text) : "")
		}
	];

	const [registerTable] = useTable({
		api: patOrdersItemsPage,
		columns,
		useSearchForm: true,
		formConfig: {
			schemas: searchFormSchema,
			labelWidth: 100,
			showActionButtonGroup: true,
			actionColOptions: { span: 24 }
		}
	});
	return (
		<div className="page Reconciliation">
			<div className="page-content">
				<BasicTable register={registerTable}></BasicTable>
			</div>
			<ToolBar btnList={[{ key: "print", disabled: true }]}></ToolBar>
		</div>
	);
};
export default index;
